package cn.edu.scau.cmi.chenyiqiu.abstractFactory.domainFactory;

import cn.edu.scau.cmi.chenyiqiu.abstractFactory.domainabstractClass.Meat;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
import cn.edu.scau.cmi.chenyiqiu.abstractFactory.domain.*;

public class Controller {
	@FXML
	private Button sure;
	@FXML
	private  TextArea InsText;
	@FXML
	private  ComboBox brand;
	@FXML
	private  ComboBox produce;
	public void sureinfo() {
		/*InsText.setText("你好！");*/
		
		
		if(brand.getSelectionModel().isEmpty()||produce.getSelectionModel().isEmpty())
			InsText.setText("请选择!");
		else {
		String mark = brand.getValue().toString();
		String type =produce.getValue().toString();
		BrandAbstractFactory b=BrandAbstractFactory.getBrand(mark);
		Meat m = null;
		if(type.equals(Meat.Beef))
			m=b.getBeef();
		else if(type.equals(Meat.Pork))
			m=b.getPork();
		else if(type.equals(Meat.Chicken))
			m=b.getChicken();
		String info =m.getInfo();
		InsText.setText(info);

		}
		
		
		
		
	}

}
